package it.websiteinventor.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by 30067ciamberlano on 13/08/14.
 */
@Controller
public class MainController {

    @RequestMapping("/")
    public String homeController (Model model) {
        return "homepage";
    }

    @RequestMapping("/p/{pid}")
     public String pageController (@PathVariable("pid") String pid, Model model) {

        model.addAttribute("id",pid);

        return "page";

    }

    @RequestMapping("/o/{oid}")
    public String objectController (@PathVariable("oid") String oid, Model model) {

        model.addAttribute("id",oid);

        return "object";

    }
}
